<?php

/**
 * User actions.
 *
 * @package    ieasy
 * @subpackage User
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class userActions extends sfActions
{
    /**
     * Executes index action
     *
     * @param sfRequest $request A request object
     */
    public function connstr()
    {
        //$server="172.16.0.58";
        $server = "192.168.1.230";
        $server = ".";
        $username = 'sa';
        $password = '123456';
        $database = 'iEasy_new';
        $connstr = "Driver={SQL Server Native Client 10.0};Server=localhost;Database=$database";
        $dbconn = odbc_connect($connstr, $username, $password, SQL_CUR_USE_ODBC);
        if (!$dbconn) {
            die('Could not connect: ');
        }
        else return $dbconn;
    }

    public function executeIndex()
    {
        $this->forward("user", "login");
    }

    public function executeValidgd()
    {
    }

    public function executeRegister()
    {
        $this->response->setTitle("注册_MY Easy_" . sfConfig::get("app_site_name"));
    }

    public function executeLogin()
    {
        $this->response->setTitle("登录_MY Easy_" . sfConfig::get("app_site_name"));
    }

    public function executeGetpassword()
    {
        $this->forward("user", "login");
    }

    public function executeResultpage()
    {
        //$this->yzm=$this->getUser()->getAttribute("code");
        $this->user_lable = $_POST["lable"];
        $this->user_name = $_POST["user_name"];
        $user_name = $this->user_name;
        $connection = Doctrine_Manager::connection();

        $this->exist = 0;
        if ($this->user_lable == 1) //登陆
        {
            $userpwd = $_POST["password"];
            //$this->yzm=$this->getUser()->getAttribute("code");//$_POST["yzm"];
            $sql2 = "select * from Users where name='" . $user_name . "'";
            $STH = $connection->execute($sql2);
            $STH->setFetchMode(PDO::FETCH_ASSOC);
            if ($rows = $STH->fetch()) {
                if ($userpwd == $rows['password']) {
                    $this->exist = 1;
                    $this->getUser()->setAttribute('userName', $user_name);
                    $this->getUser()->setAttribute('userId', $rows['user_id']);
                    if ($this->yzm != $this->yzm) {
                        $this->exist = 2;
                    }
                    $this->redirect("user/home");
                }
            }
            else
            {
                $this->exist = -1;
            }
        }
        else if ($this->user_lable == 0) { //注册
            $userpwd = $_POST["password"];
            $user_nice = $_POST["user_nice"];
            $sql2 = "select name from Users ";
            $STH = $connection->execute($sql2);
            $STH->setFetchMode(PDO::FETCH_ASSOC);
            while ($row = $STH->fetch()) {
                if ($user_name == $row['name']) {
                    $this->exist = -1;
                    break;
                }
            }
            if ($this->exist == 0) {
                $sql2 = "insert into Users (name,nickname,password,sex,email,create_time,is_activate_b) values ('" . $user_name . "','" . $user_nice
                        . "','" . $userpwd . "','" . $_POST["sex"] . "','" . $_POST["user_email"] . "','" . date("Y-m-d H:i:s") . "',1)";
                $STH = $connection->execute($sql2);
                if ($STH) {
                    $this->exist = 1;
                    /*$this->getUser()->setAttribute('userName', $user_name);
                    $this->getUser()->setAttribute('userId', $rows['user_id']);*/
                }
            }
        }
        else if ($this->user_lable == -1) //找回密码
        {
            $this->forward("user", "login");
            //$this->yzm=$this->getUser()->getAttribute("code");
            /*$sql2="select *,cast(password as varchar(100))password from [Users] ";
            $connection = Doctrine_Manager::connection();
            $STH=$connection->execute($sql2);
            $STH->setFetchMode(PDO::FETCH_ASSOC);
            while($row=$STH->fetch()){
                if($user_name==$row['name'])
                {
                    $this->exist=1;
                    $this->userpwd=$row['password'];
                    break;
                }
            }*/
        }
    }

    public function executeTurnpage()
    {
        if (empty($_REQUEST["contentId"]))
            $this->contentId = "1075";
        else
            $this->contentId = $_REQUEST["contentId"];
        if (empty($_REQUEST["contentTypeId"]))
            $this->contentTypeId = "1003";
        else
            $this->contentTypeId = $_REQUEST["contentTypeId"];
        if (empty($_REQUEST["recordCount"]))
            $this->recordCount = "10";
        else
            $this->recordCount = "10";
        //$_REQUEST["recordCount"];
        if (empty($_REQUEST["currentPage"]))
            $this->currentPage = "1";
        else
            $this->currentPage = $_REQUEST["currentPage"];
        $query = Doctrine_Query::create()->from("Comment c")
                ->where('content_id=' . $this->contentId)->andWhere('c.content_type_i=' . $this->contentTypeId);
        $query = $query->orderBy('c.create_time desc,c.modify_time desc');
        $this->pages = new sfDoctrinePager('Comment', $this->recordCount); //$this->currentPage
        $this->pages->setQuery($query); //$q   数据库查询语句
        $this->pages->setPage($this->currentPage); //
        $this->pages->init();
    }

    public function executeShare()
    {
        if (!empty($_POST["lable"])) {
            $this->share_lable = $_POST["lable"];
            $connection = Doctrine_Manager::connection();
        }
        if ($this->share_lable == 1) {
            //$this->user_name=$_POST["user_name"];
            // $user_name=$this->user_name;
            $user_name = "newuser";
            $info_title = $_POST["info_title"];
            $info_detail = $_POST["info_detail"];
            // $news = @Doctrine_Core::getTable('News');
            $news = new News();
            $news->setTitle($info_title);
            $news->setAuthor($user_name);
            $news->setBody($info_detail);
            $news->save();
            $this->redirect('user/home');
            // One to many relationship
        }
        else if ($this->user_lable == 2) {
            $info_title = $_POST["info_title"];
            //$this->user_name=$_POST["user_name"];
            // $user_name=$this->user_name;
            $user_name = "newuser";
            $info_detail = $_POST["info_detail"];
            $sql2 = "insert into Photo (link,brief,photo_group_id) values ('/images/" . $info_title . ".jpg','" . $info_title . "','" . $info_detail . "')";
            $STH = $connection->execute($sql2);
            if ($STH) {
                $this->redirect('user/home');
            }
        }
        else if ($this->user_lable == 3) {
            $info_title = $_POST["info_title"];
            //$this->user_name=$_POST["user_name"];
            // $user_name=$this->user_name;
            $user_name = "newuser";
            $info_detail = $_POST["info_detail"];
            $sql2 = "insert into video (snapshot_big,title,prim_video_group_id) values ('" . $user_name . "','" . $info_title . "','" . $info_detail . "')";
            $STH = $connection->execute($sql2);
            if ($STH) {
                $this->redirect('user/home');
            }
        }
    }

    public function executeHome(sfWebRequest $request)
    {
        $this->userName = $this->getUser()->getAttribute('userName');
        $this->userId = $this->getUser()->getAttribute('userId');
        if (empty($this->userId)) {
            $this->forward("user", "index");
            return;
        }
        $connection = @Doctrine_Manager::connection();
        $query = 'SELECT * FROM users where user_id=' . $this->userId;
        $STH = $connection->execute($query);
        $STH->setFetchMode(PDO::FETCH_ASSOC);
        $i = 0;
        while ($row = $STH->fetch()) {
            $i++;
            $this->avatar = $row['avatar'];
            $this->nickname = $row['nickname'];
            $this->last_survey_time = $row['last_survey_time'];
            $this->email = $row['email'];
            $this->address = $row['address'];
            $this->name = $row['name'];
            $this->sex = $row['sex'];
            $this->birthday = $row['birthday'];
            $this->telephone = $row['telephone'];
            $this->cellphone = $row['cellphone'];
            $this->real_name = $row['real_name'];
            $this->create_time = $row['create_time'];
        }
        if ($i < 1) {
            $this->forward("user", "index");
            return;
        }
        $query = Doctrine_Query::create()->from("comment c")
                ->where('user_id=' . $this->userId);
        $query = $query->orderBy('c.modify_time desc,c.create_time desc');

        $this->pages = new sfDoctrinePager('comment', 10); //$this->currentPage
        $this->pages->setQuery($query); //$q   数据库查询语句
        $this->pages->setPage(1); //
        $this->pages->init();
        $this->response->setTitle($this->name . "_MY Easy_" . sfConfig::get("app_site_name"));
    }

    public function executeAddcomment(sfWebRequest $request)
    {
        if (!empty($_POST["contentId"])) //
        {
            if (!empty($_POST["user_id"]) && !empty($_POST["contentId"]) && !empty($_POST["contentTypeId"]) && !empty($_POST["comtext"])) {
                $sql2 = "insert into Comment(content_id,user_id,body,content_type_i,create_time,modify_time,user_ip,status_id)
                                values ('" . $_POST["contentId"] . "','" . $_POST["user_id"] . "','" . $_POST["comtext"] . "','" .
                        $_POST["contentTypeId"] . "','" . date("Y-m-d H:i:s") . "','" . date("Y-m-d H:i:s") . "','" . $request->getHttpHeader('addr', 'remote') . "',1005)";

                $connection = Doctrine_Manager::connection();
                $STH = $connection->execute($sql2);


                //                try {
                //                    $user = Doctrine_Core::getTable("Users")->find($_POST["user_id"]);
                //                    $comment = new Comment();
                //                    $comment->setContentId($_POST["contentId"]);
                //                    //                    $comment->setUserId($_POST["user_id"]);
                //                    $comment->setUsers($user);
                //                    $comment->setBody($_POST["comtext"]);
                //                    //                $comment->setContentTypeI($_POST["contentTypeId"]);
                //                    $comment->setCreateTime(date("Y-m-d H:i:s"));
                //                    $comment->setModifyTime(date("Y-m-d H:i:s"));
                //                    $comment->setUserIp($request->getHttpHeader('addr', 'remote'));
                //                    $comment->setStatusId(1005);
                //                    $comment->trySave();
                //                } catch (Exception $e) {
                //                    echo $e->getTraceAsString();
                //                }
                if ($STH) {
                    $this->iscomment = 1;
                }
            }
            if ($request->isXmlHttpRequest()) {
                return $this->renderComponent('user', 'commentlist', array('contentId' => $_POST["contentId"], 'contentTypeId' => $_POST["contentTypeId"], 'recordCount' => $_POST["recordCount"]));
            }
        }
        else {
            if (!empty($_POST["old_password"])) //修改密码
            {
                if (!empty($_POST["user_id"]) && !empty($_POST["new_password"])) {
                    $sqlStr1 = "select password from users where user_id='" . $_POST["user_id"] . "' and password='" . $_POST["old_password"] . "'";
                    $sqlStr = "update users set password='" . $_POST["new_password"] . "' where user_id='" . $_POST["user_id"] . "' and password='" . $_POST["old_password"] . "'";
                    $connection = @Doctrine_Manager::connection();
                    $STH = $connection->execute($sqlStr1);
                    $STH->setFetchMode(PDO::FETCH_OBJ);
                    if ($row = $STH->fetch()) {
                        if ($STH2 = $connection->execute($sqlStr)) {
                            $this->iscomment = 1;
                            echo $this->modify_result = "修改成功！";
                        }
                    }
                    else {
                        echo $this->modify_result = "旧密码有误！";
                    }
                }
            } else if (!empty($_POST["modifysnap"])) {
                if (1 == $_POST["modifysnap"]) {
                    if (!empty($_POST["snapshot"])) {
                        $sqlinfo = "update users set avatar='" . $_POST["snapshot"] . "'";
                        $sqlinfo = $sqlinfo . " where user_id='" . $_POST["user_id"] . "'";
                        $connection = @Doctrine_Manager::connection();
                        if ($STH = $connection->execute($sqlinfo)) {
                            echo "信息更新成功！";
                        }
                    }

                }
            }
            else if ($request->isXmlHttpRequest()) {
                $this->userId;
                if (!empty($_POST["m_nickname"])) {
                    $sqlinfo = "update users set nickname='" . $_POST["m_nickname"] . "'";
                    if (!empty($_POST["m_email"])) {
                        $sqlinfo = $sqlinfo . ",email='" . $_POST["m_email"] . "'";
                    }
                    if (!empty($_POST["m_sex"])) {
                        $sqlinfo = $sqlinfo . ",sex='" . $_POST["m_sex"] . "'";
                    }
                    if (!empty($_POST["m_birthday"])) {
                        $sqlinfo = $sqlinfo . ",birthday='" . $_POST["m_birthday"] . "'";
                    }
                    if (!empty($_POST["m_telephone"])) {
                        $sqlinfo = $sqlinfo . ",telephone='" . $_POST["m_telephone"] . "'";
                    }
                    if (!empty($_POST["m_cellphone"])) {
                        $sqlinfo = $sqlinfo . ",cellphone='" . $_POST["m_cellphone"] . "'";
                    }
                    if (!empty($_POST["m_real_name"])) {
                        $sqlinfo = $sqlinfo . ",real_name='" . $_POST["m_real_name"] . "'";
                    }
                    if (!empty($_POST["m_address"])) {
                        $sqlinfo = $sqlinfo . ",address='" . $_POST["m_address"] . "'";
                    }
                    $sqlinfo = $sqlinfo . " where user_id='" . $_POST["user_id"] . "'";
                    $connection = @Doctrine_Manager::connection();
                    if ($STH = $connection->execute($sqlinfo)) {
                        echo "信息更新成功！";
                    }
                }
                if (1 == 0) {
                    return $this->renderComponent('user', 'homeinfo', array('str' => $_POST["comtext"], 'userId' => $_POST["user_id"]));
                }
                if (!empty($_POST["username_chksql"])) {
                    $sqlStrchk = "select password from users where name='" . $_POST["username_chksql"] . "'";
                    $connection = @Doctrine_Manager::connection();
                    $CHK = $connection->execute($sqlStrchk);
                    $CHK->setFetchMode(PDO::FETCH_OBJ);
                    if ($row = $CHK->fetch()) {
                        echo "already";
                    }
                }
            }
        }
    }

    public function executeSessiont(sfWebRequest $request)
    {

    }

    public function executeAddinfos(sfWebRequest $request)
    {
        $this->execSql = $request->getParameter("photoEdit");
        $this->results = "";
        switch ($this->execSql) {
            case "1":
                $photoGroup = new PhotoGroup();
                $titles = $request->getParameter("title");
                $photoGroup->setTitle($titles);
                $photoGroup->setBrief($request->getParameter("brief"));
                $photoGroup->setUserId($this->getUser()->getAttribute('userId'));
                $urls = "/" . utility::uploadFile("photo", "Txt1");
                $photoGroup->setSnapshot($urls);
                $photoGroup->setIsAuditB(0);
                $photoGroup->setHitMaskI(0);
                $photoGroup->setIsHeaderB(0);
                $photoGroup->setIsRecommendB(0);
                $photoGroup->setIsOnTopB(0);
                $photoGroup->setIsFocusB(0);
                $photoGroup->setCreateTime(date("Y-m-d H:i:s"));
                $photoGroup->setModifyTime(date("Y-m-d H:i:s"));
                $this->results = $photoGroup->getUserId();
                $photoGroup->save();
                $groupId = $photoGroup->getPhotoGroupId();
                if ($groupId >= 1) {
                    for ($i = 1; $i <= 20; $i++) {
                        $photo = new Photo();
                        if ($i == 1)
                            $hids = $urls;
                        else
                        {
                            $hids = @utility::uploadFile('photo', 'Txt' . $i);
                            if (null == $hids || "" == $hids) break;
                        }
                        $photo->setLink($hids);
                        $photo->setBrief($request->getParameter("Des" . $i));
                        $photo->setPhotoGroupId($groupId);
                        $photo->setOrderI($i);
                        $photo->save();
                    }
                }
                $this->forward("user", "home");
                break;
            default:
                break;

        }

    }

    public function executeTurninfos(sfWebRequest $request)
    {
        $userId = $this->getUser()->getAttribute('userId');
        if (empty($userId)) {
            $this->forward("user", "index");
            return;
        }
        if (2 == $_REQUEST["userEdit"]) //修改用户信息
        {
            $userinfo = @Doctrine_Core::getTable("users")->find($this->getUser()->getAttribute('userId'));
            switch ($_REQUEST["userload"])
            {
                case "1": //修改密码
                    $result = 2; //失败
                    if ($userinfo->getPassword() == md5($request->getParameter('password'))) {
                        $userinfo->setPassword(md5($request->getParameter('truesword')));
                        $userinfo->save();
                        $result = 1; //成功
                    }
                    $this->redirect('user/home?show=' . $request->getParameter("userload") . "&res=" . $result);
                    break;
                case "2": //修改个人信息
                    $result = 2; //成功
                    $userinfo->setEmail($request->getParameter('Info_email'));
                    $userinfo->setNickname($request->getParameter('Info_nice'));
                    $userinfo->setRealName($request->getParameter('Info_real'));
                    $userinfo->setSex($request->getParameter('Info_sex'));
                    $userinfo->setBirthday($request->getParameter('Info_birthday'));
                    $userinfo->setTelephone($request->getParameter('Info_tel'));
                    $userinfo->setCellphone($request->getParameter('Info_cel'));
                    $userinfo->setAddress($request->getParameter('Info_address'));
                    @$userinfo->save();
                    $result = 1;
                    $this->redirect('user/home?show=' . $request->getParameter("userload") . "&res=" . $result);
                    break;
                case "3": //修改头像
                    $hids = @utility::uploadFile('snapshot', 'file1');
                    $userinfo->setAvatar("/" . $hids);
                    @$userinfo->save();
                    $this->redirect('user/home?show=' . $request->getParameter("userload"));
                    break;
                case "4": //添加相册

                    break;
                case "5": //添加相片

                    break;
                case "6": //删除相册
                    $photogroupD = @Doctrine_Core::getTable("PhotoGroup")->find($request->getParameter('contentId'));
                    $photogroupD->setStatusId(1006);
                    @$photogroupD->save();
                    break;
                case "7": //删除相片
                    $content = $request->getParameter("contentId");
                    $i = 0;
                    $this->phoId = "";
                    $this->phogId = "";
                    if (!empty($content)) {
                        $Ids = explode(".", $content);
                        for ($i; $i < 2; $i++)
                        {
                            if (!empty($Ids[$i])) {
                                if ($i == 0)
                                    $this->phoId = $Ids[$i];
                                if ($i == 1)
                                    $this->phogId = $Ids[$i];
                            }
                        }
                    }
                    if ($i > 0) {
                        $photoD = @Doctrine_Core::getTable("Photo")->find($this->phoId);
                        $photoD->delete();
                    }
                    break;
                case "8": //设为头像
                    $content = $request->getParameter("contentId");
                    $i = 0;
                    $this->phoId = "";
                    $this->phogId = "";
                    if (!empty($content)) {
                        $Ids = explode(".", $content);
                        for ($i; $i < 2; $i++)
                        {
                            if (!empty($Ids[$i])) {
                                if ($i == 0)
                                    $this->phoId = $Ids[$i];
                                if ($i == 1)
                                    $this->phogId = $Ids[$i];
                            }
                        }
                    }
                    if ($i > 0) {
                        $photoD = @Doctrine_Core::getTable("Photo")->find($this->phoId);
                        $userinfo->setAvatar($photoD->getLink());
                        $userinfo->save();
                    }
                    break;
                case "9": //设为封面
                    $content = $request->getParameter("contentId");
                    $i = 0;
                    $this->phoId = "";
                    $this->phogId = "";
                    if (!empty($content)) {
                        $Ids = explode(".", $content);
                        for ($i; $i < 2; $i++)
                        {
                            if (!empty($Ids[$i])) {
                                if ($i == 0)
                                    $this->phoId = $Ids[$i];
                                if ($i == 1)
                                    $this->phogId = $Ids[$i];
                            }
                        }
                    }
                    if ($i > 0) {
                        $photoD = @Doctrine_Core::getTable("Photo")->find($this->phoId);
                        $photogD = @Doctrine_Core::getTable("PhotoGroup")->find($this->phogId);
                        $photogD->setSnapshot($photoD->getLink());
                        @$photogD->save();
                    }
                    break;
                default: //不做任何修改
                    break;
            }
        } else
        {
            switch ($_REQUEST["userload"])
            {
                case "1": //加载密码

                    break;
                case "2": //加载个人信息
                    $this->userinfo = @Doctrine_Core::getTable("users")->find($this->getUser()->getAttribute('userId'));
                    break;
                case "3": //加载头像
                    break;
                case "4": //加载相册
                    //分页
                    $this->recordCount = $request->getParameter('recordCount');
                    $this->currentPage = $request->getParameter('currentPage');
                    if (null == $this->recordCount || "" == $this->recordCount)
                        $this->recordCount = 200;
                    //42
                    if (null == $this->currentPage || "" == $this->currentPage)
                        $this->currentPage = 1;
                    $query = @Doctrine_Query::create()->from("PhotoGroup p")
                            ->where("user_id='" . $this->getUser()->getAttribute('userId') . "'")
                            ->andWhere('p.status_id=1005');
                    $query = $query->orderBy('p.modify_time desc,p.photo_group_id desc');
                    $this->pages = new sfDoctrinePager('PhotoGroup', $this->recordCount);
                    $this->pages->setQuery($query); //$q   数据库查询语句
                    $this->pages->setPage($this->currentPage); //
                    $this->pages->init();
                    break;
                case "5": //加载相片
                    $this->recordCount = $request->getParameter('recordCount');
                    $this->currentPage = $request->getParameter('currentPage');
                    $this->photoT = @Doctrine_Core::getTable("PhotoGroup")->find($request->getParameter('contentId'));
                    if (null == $this->recordCount || "" == $this->recordCount)
                        $this->recordCount = 200;
                    //42
                    if (null == $this->currentPage || "" == $this->currentPage)
                        $this->currentPage = 1;
                    $query = Doctrine_Query::create()->from("Photo p")
                            ->where("photo_group_id='" . $request->getParameter('contentId') . "'");
                    $query = $query->orderBy('p.order_i asc');
                    $this->pages = new sfDoctrinePager('Photo', $this->recordCount);
                    $this->pages->setQuery($query); //$q   数据库查询语句
                    $this->pages->setPage($this->currentPage); //
                    $this->pages->init();
                    //分页
                    break;
                case "6": //加载用户基本资料
                    $this->userinfo = @Doctrine_Core::getTable("users")->find($this->getUser()->getAttribute('userId'));
                    break;
                default: //默认信息
                    break;
            }
        }

    }

    public function executeEditinfos(sfWebRequest $request)
    { //相册
        $userId = $this->getUser()->getAttribute('userId');
        if (empty($userId)) {
            $this->forward("user", "index");
            return;
        }
        if (2 == $_REQUEST["userEdit"]) //修改相关信息
        {
            switch ($_REQUEST["userload"])
            {
                case "1": //保存新建相册
                    $photogroup = new PhotoGroup();
                    $hids = @utility::uploadFile('snapshot', 'file1');
                    $photogroup->setTitle($_REQUEST["photo_title1"]);
                    $photogroup->setSnapshot("/" . $hids);
                    $photogroup->setIsAuditB(0);
                    $photogroup->setHitI(0);
                    $photogroup->setHitMaskI(0);
                    $photogroup->setIsHeaderB(0);
                    $photogroup->setIsOnTopB(0);
                    $photogroup->setIsRecommendB(0);
                    $photogroup->setIsFocusB(0);
                    $photogroup->setStatusId(1005);
                    $photogroup->setUserId($userId);
                    $photogroup->setCreateTime(date("Y-m-d H:i:s"));
                    $photogroup->setModifyTime(date("Y-m-d H:i:s"));
                    $photogroup->save();
                    $this->redirect('user/home?show=4');
                    break;
                case "2": //添加相片
                    $photoid = $_REQUEST["photoId"];
                    if ($photoid > 0) {
                        for ($i = 1; $i <= 5; $i++)
                        {
                            if (strlen($_FILES["file" . $i]["name"]) > 0) {
                                $hids = @utility::uploadFile('snapshot', "file" . $i);
                                $photo = new Photo();
                                $photo->setLink("/" . $hids);
                                $photo->setBrief($_REQUEST["photo_title" . $i]);
                                $photo->setPhotoGroupId($photoid);
                                $photo->save();
                            }

                        }
                    }
                    $this->redirect("user/home?pho=" . $request->getParameter('photoId'));
                    break;
                case "3":
                    break;
                case "4": //修改相册名称
                    $photonew = @Doctrine_Core::getTable("PhotoGroup")->find($request->getParameter('photoId'));
                    $photonew->setTitle($_REQUEST["addGname"]);
                    $photonew->setModifyTime(date("Y-m-d H:i:s"));
                    $photonew->save();
                    $this->redirect("user/home?pho=" . $request->getParameter('photoId'));
                    break;
                default:
                    break;
            }
            $this->redirect("user/home");
        } else
        { //加载编辑页面
            switch ($_REQUEST["userload"])
            {
                case "1": //加载新建相册页面
                    break;
                case "2": //加载添加相片页面

                    break;
                case "3": //加载相片详细页面
                    break;
                case "4": //加载相册改名页面
                    $this->photoT = @Doctrine_Core::getTable("PhotoGroup")->find($request->getParameter('contentId'));
                    break;
                default:
                    break;
            }

        }
    }
}
